using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PATIENTDentMap : EntityTypeConfiguration<SO_PATIENTDent>
    {
        public SO_PATIENTDentMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Latin_Last_Name, t.Arabic_Last_Name, t.IID, t.Mobile, t.CURRENT_PATIENT });

            // Properties
            this.Property(t => t.ID)
                .HasMaxLength(6);

            this.Property(t => t.CASE__)
                .HasMaxLength(15);

            this.Property(t => t.Latin_Name)
                .HasMaxLength(30);

            this.Property(t => t.Arabic_Name)
                .HasMaxLength(40);

            this.Property(t => t.Latin_Last_Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Arabic_Last_Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.IID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Phones)
                .HasMaxLength(30);

            this.Property(t => t.Mobile)
                .IsRequired()
                .HasMaxLength(19);

            this.Property(t => t.ADDRESS)
                .HasMaxLength(80);

            this.Property(t => t.NATIONALITY)
                .HasMaxLength(20);

            this.Property(t => t.Gender)
                .HasMaxLength(7);

            this.Property(t => t.CURRENT_PATIENT)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.ID_Number)
                .HasMaxLength(20);

            this.Property(t => t.Primay_Care_Physician)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("SO_PATIENTDent");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.CASE__).HasColumnName("CASE_#");
            this.Property(t => t.Latin_Name).HasColumnName("Latin_Name");
            this.Property(t => t.Arabic_Name).HasColumnName("Arabic_Name");
            this.Property(t => t.Latin_Last_Name).HasColumnName("Latin_Last_Name");
            this.Property(t => t.Arabic_Last_Name).HasColumnName("Arabic_Last_Name");
            this.Property(t => t.IID).HasColumnName("IID");
            this.Property(t => t.Phones).HasColumnName("Phones");
            this.Property(t => t.Mobile).HasColumnName("Mobile");
            this.Property(t => t.ADDRESS).HasColumnName("ADDRESS");
            this.Property(t => t.NATIONALITY).HasColumnName("NATIONALITY");
            this.Property(t => t.Gender).HasColumnName("Gender");
            this.Property(t => t.CURRENT_PATIENT).HasColumnName("CURRENT_PATIENT");
            this.Property(t => t.ID_Number).HasColumnName("ID_Number");
            this.Property(t => t.Date_added).HasColumnName("Date_added");
            this.Property(t => t.Primay_Care_Physician).HasColumnName("Primay_Care_Physician");
        }
    }
}
